<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
	<!--<![endif]-->
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>统计</title>
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>

		<meta content="telephone=no" name="format-detection" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style" />

		<!-- 引入样式 -->
		<link rel="stylesheet" href="../styles/vant.css">
		<link rel="stylesheet" href="../styles/common.css" />
		<link rel="stylesheet" href="../styles/global.css" />
		<link rel="stylesheet" href="../styles/statistics.css" />
		<link rel="stylesheet" href="../styles/font.css">
		<!-- 引入组件 -->
		<script src="../scripts/babel.js"></script>
		<script src="../scripts/rem.js"></script>
		<script src="../scripts/vue.js"></script>
		<script src="../scripts/api.js"></script>
		<script src="../scripts/axios.js" charset="utf-8"></script>
		<script src="../scripts/vant.js"></script>
		<!-- <script src="//cdn.jsdelivr.net/npm/eruda"></script>
		<script>eruda.init();</script> -->
		<style type="text/css">
			.van-list__finished-text {
				height: 15vh;
			}
			.van-list__loading {
				height: 15vh;
			}
		</style>
	</head>
	<body>
		<!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
		<div class="container" id="app">
			<div class="header">
				<div @click="go_back"><span><i class="iconfont icon-back"></i></span></div>
				<div>统计/结算</div>
				<div class="headericon"></div>
			</div>
			<div class="plenl">
				<div class="plenlplenl">
					<van-list v-model="loading" :finished="finished" :offset="300" finished-text="没有更多了" @load="cys_load">
						<div v-for="item in list" style="border-bottom: 1px solid #ebebeb;">
							<div class="list_title" v-text="item.day">
							</div>
							<div class="ftitle" v-text="item.remark">
							</div>
							<div v-if="item.type!=1" class="title" v-text="item.income">
							</div>
							<div class="tabtitle">
								<div v-if="item.type!=1">
									<p>快付</p>
									<p v-text="item.qr"></p>
								</div>
								<div v-if="item.type!=1">
									<p>订单</p>
									<p v-if="item.mchorder" v-text="item.mchorder"></p>
									<p v-if="item.mchorder==''" v-text="'0'"></p>
								</div>
								<div v-if="item.type==1">
									<p>结算金额</p>
									<p v-text="item.settle"></p>
								</div>
								<div>
									<p>余额：</p>
									<p v-text="item.balance"></p>
								</div>
							</div>
						</div>
					</van-list>
				</div>
			</div>

		</div>
	</body>   
   	<script type="text/babel">
   	new Vue({
   		el: '#app',
   		data: {
   			url: "",
   			userId: "",
   			token: "",
   			admin: "",
   			data: {
   				paymentamt: '',
   				count: '',
   			},
   			list: [],
   			loading: false,
   			finished: false,
   			currypage: 0,
   			
   		},
   		
   		mounted: function() {
   			this.url = url();
   			this.admin = JSON.parse(localStorage.getItem("admin"));
   			if (!this.admin) {
   				this.$notify("非法登录，请重新登陆");
   				setTimeout(this.go_login, 2000);
   				return
   			}
   			this.userId = this.admin.mid;
   			this.token = this.admin.token;
   		},
   		
   		methods: {	 
   			cys_load() {
   				// 异步更新数据
   				var that = this;
   				that.currypage++
   				this.selectMchBalanceDet(this.currypage);
   			},
   			// 商户收款记录展示/mchapp/info/selectMchOrderList
   			selectMchBalanceDet: function(page) {
   				var that = this;
   				var data = {
   					userId: that.userId,
   					token: that.token,
   					requestString: JSON.stringify({
   						mid: that.userId,
   						pagesize: 5,
   						pagenumber: page
   					})
   				}
   				console.log(data)
   				this.loading=true;
   				axios.post(that.url + '/mchapp/info/selectMchBalanceDet', data).then(function(response) {							
					if (response.data.code == 200) {
						that.data = response.data;
						if (response.data.list.length <= 0) {
							that.finished = true;
							that.loading = false;
						}  else {
							that.list = that.list.concat(response.data.list);
							console.log(that.list)
						}
						// 加载状态结束
						setTimeout(function(){that.loading = false;},1000);								
					} else if(response.data.code == 300){
						that.$notify("账号在别处登录，将为您返回登录页面");//							
						if(that.admin.teltype==1){
							logout_app(that.admin.mid,1)
						}
						if(that.admin.teltype==2){
							logout_app(that.admin.mid,2)
						}	
						window.location.href = '../login.html';
					} else {
						that.$notify(response.data.disp);
					}
				})
						
			},
	go_back: function() {
		window.history.back(-1);
	},
	go_login: function() {
		window.location.href ='../login.html';
   	},
   		},
   
   	})
   </script>
   
   
</html>
